#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;
/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     ListNode *next;
 *     ListNode(int x) : val(x), next(NULL) {}
 * };
 */
struct ListNode {
    int val;
    ListNode* next;
    ListNode(int x)
        : val(x), next(NULL) {}
};

class Solution {
   public:
    vector<int> reversePrint(ListNode* head) {
        vector<int> v;
        if (head == nullptr) {
            return v;
        }
        while (head) {
            v.push_back(head->val);
            head = head->next;
        }
        reverse(v.begin(), v.end());
        return v;
    }
};

int main() {
    return 0;
}
